package com.base.ch01;

import javafx.scene.media.SubtitleTrack;

/**
 * 数组测试类
 */
public class App {
    public static void main( String[] args ){
        //testMyArray();
        testMyOrderArray();
    }

    /**
     * 测试有序数组testMyOrderArray
     */
    public static void testMyOrderArray(){
        MyOrderArray myOrderArray = new MyOrderArray();
        myOrderArray.insert(10);
        myOrderArray.insert(50);
        myOrderArray.insert(30);
        myOrderArray.insert(90);

        myOrderArray.display();


        int index = myOrderArray.binarySearch(90);
        System.out.println(index);
    }


    /**
     * 测试普通数组MyArray
     */
    public static void testMyArray(){

        MyArray myArray = new MyArray();
        myArray.insert(10);
        myArray.insert(50);
        myArray.insert(30);
        myArray.insert(90);


        myArray.display();
        System.out.println(myArray.size());

        myArray.delete(0);
        myArray.display();

        long value = myArray.get(2);
        System.out.println(value);

        int index = myArray.search(90);
        System.out.println(index);

        myArray.change(0,4);
        myArray.display();

    }
}
